<template>
  <div>
    <el-card>
      <div slot="header" class="clearfix">
        员工姓名：<el-input v-model="params.name" placeholder="请输入员工姓名" style="width:220px;margin:0 10px" />
        <el-button type="primary" @click="onClick">查询</el-button>
      </div>
      <el-button type="primary">
        添加员工
      </el-button>
      <el-table :data="list">
        <el-table-column label="序号">
          <template #default="{$index}">
            {{ $index+1 }}
          </template>
        </el-table-column>
        <el-table-column label="员工姓名" prop="name" />
        <el-table-column label="登录账号" prop="userName" />
        <el-table-column label="联系方式" prop="phonenumber" />
        <el-table-column label="角色" prop="roleName" />
        <el-table-column label="状态" prop="status">
          <template #default="{row}">
            {{ row.status===0?'未启用':'启用' }}
          </template>
        </el-table-column>
        <el-table-column label="添加时间" prop="createTime" />
        <el-table-column label="操作">
          <el-button type="text">编辑</el-button>
          <el-button type="text">删除</el-button>
          <el-button type="text">重置密码</el-button>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
import { getStaffListAPI } from '@/api/system'
export default {
  data() {
    return {
      list: [],
      params: {
        name: ''
      }
    }
  },
  created() {
    this.onLoad()
  },
  methods: {
    // 点击查询
    onClick() {
      this.onLoad()
    },
    async onLoad() {
      const res = await getStaffListAPI(this.params)
      console.log(res)
      this.list = res.data.rows
    }
  }
}
</script>

<style>

</style>
